snippet function  "definition of function" b
function! `!p
import os
import re
names, filename = os.path.splitext(os.path.abspath(path))
filepath = re.split("autoload", names)
if len(filepath) > 1:
	subpath = filepath[1]
	text = os.path.split(subpath[1:])
	snip.rv = '#'.join(text) + '#'
else:
	snip.rv = 's:'
`${1:init}() abort
    ${2}
endfunction
endsnippet

snippet get "get()" w
get(g:, "${1}", { "name": "+${2}"})${0}
endsnippet

snippet ex "exists" w
exists("${1:g:}")${0}
endsnippet

snippet ifex "if exist g:loaded_<plug>" b
if exists("g:${1:loaded_<plug>}") && g:${1}
    ${2}
endif
endsnippet

snippet ifnex "if not exist g:loaded_<plug>" b
if !exists('g:${1:variable name}')
	${2:try}
endif
endsnippet

snippet ifelse "if with else " b
if ${1:v:false}
    ${2}
else
    ${3}
endif
${0}
endsnippet

snippet try "try catch" b
try
	${1}
catch /.*/
	${2:echoerr v:exception}
endtry
endsnippet
